package com.lfx.concurrent.compete;

/**
 * @author 李逢喜
 * create 2021/7/30
 */
public class ConcurrentDemo {


    private double amount;


    public synchronized void modify(double amount){
        double value = this.amount;
        this.amount = value + amount;
        System.out.println(amount);
    }


    public static void main(String[] args) {
        ConcurrentDemo concurrentDemo=new ConcurrentDemo();
        for (int i = 0; i < 5; i++) {
            new MyThread(concurrentDemo,i).start();
        }

    }
}
